package bubbleindex;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
import javax.swing.JComboBox;

/**
 *
 * @author ttrott
 */
public class GUI extends javax.swing.JFrame {

    /**
     * Creates new form GUI
     */
    public GUI() {
        initComponents();
        BubbleIndex.displayOutput("Working Dir: " + Indices.userDir, false);                          
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TitleLabel = new javax.swing.JLabel();
        RunProgram = new javax.swing.JButton();
        OutputLabel = new javax.swing.JLabel();
        OutputText = new java.awt.TextArea();
        ExitButton = new javax.swing.JButton();
        DropDownCategory = new javax.swing.JComboBox();
        DropDownSelection = new javax.swing.JComboBox();
        CategoryLabel = new javax.swing.JLabel();
        SelectionLabel = new javax.swing.JLabel();
        SelectionAreaLabel = new javax.swing.JLabel();
        ModelOptionsHeaderLabel = new javax.swing.JLabel();
        StopRunningButton = new javax.swing.JButton();
        GraphCheckBox = new javax.swing.JCheckBox();
        customBegDate = new javax.swing.JFormattedTextField(new SimpleDateFormat("yyyy-MM-dd"));
        customEndDate = new javax.swing.JFormattedTextField(new SimpleDateFormat ("yyyy-MM-dd"));
        customDates = new javax.swing.JCheckBox();
        GraphOptionsHeaderLabel = new javax.swing.JLabel();
        updateDataButton = new javax.swing.JButton();
        runAllNames = new javax.swing.JButton();
        runAllTypes = new javax.swing.JButton();
        threadsTextLabel = new javax.swing.JLabel();
        ThreadNumber = new javax.swing.JTextField();
        windowsTextField = new javax.swing.JTextField();
        WindowsLabel = new javax.swing.JLabel();
        OmegaTextLabel = new javax.swing.JLabel();
        MTextLabel = new javax.swing.JLabel();
        OmegaTextField = new javax.swing.JTextField();
        MTextField = new javax.swing.JTextField();
        TCriticalLabel = new javax.swing.JLabel();
        TCriticalField = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("The Bubble Index");

        TitleLabel.setFont(new java.awt.Font("Serif", 1, 18)); // NOI18N
        TitleLabel.setText("The Bubble Index\u2122");
        TitleLabel.setToolTipText("");

        RunProgram.setText("Run");
        RunProgram.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RunProgramActionPerformed(evt);
            }
        });

        OutputLabel.setText("Output");

        OutputText.setRows(100);

        ExitButton.setText("Exit");
        ExitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitButtonActionPerformed(evt);
            }
        });

        DropDownCategory.setModel(new javax.swing.DefaultComboBoxModel(Indices.getCategoriesAsArray()));
        DropDownCategory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DropDownCategoryActionPerformed(evt);
            }
        });

        DropDownSelection.setModel(new javax.swing.DefaultComboBoxModel(Indices.categoriesAndComponents.get((String)DropDownCategory.getSelectedItem()).getComponentsAsArray()));

        CategoryLabel.setText("Type");

        SelectionLabel.setText("Name");

        SelectionAreaLabel.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        SelectionAreaLabel.setText("Choose Index:");

        ModelOptionsHeaderLabel.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        ModelOptionsHeaderLabel.setText("Model Options:");

        StopRunningButton.setText("Stop");
        StopRunningButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StopRunningButtonActionPerformed(evt);
            }
        });

        GraphCheckBox.setText("Plot Graph");

        customBegDate.setValue(new Date(0));

        customEndDate.setValue(new Date());

        customDates.setText("Plot Custom Dates");

        GraphOptionsHeaderLabel.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        GraphOptionsHeaderLabel.setText("Graph Options:");

        updateDataButton.setText("Update Data");
        updateDataButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateDataButtonActionPerformed(evt);
            }
        });

        runAllNames.setText("Run All Names");
        runAllNames.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                runAllNamesActionPerformed(evt);
            }
        });

        runAllTypes.setText("Run All Types");
        runAllTypes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                runAllTypesActionPerformed(evt);
            }
        });

        threadsTextLabel.setText("Threads");

        ThreadNumber.setText("4");

        windowsTextField.setText("52, 104, 153, 256, 512, 1260, 1764");

        WindowsLabel.setText("Windows:");

        OmegaTextLabel.setText("Omega");

        MTextLabel.setText("M");

        OmegaTextField.setText("6.28319");

        MTextField.setText("0.37");

        TCriticalLabel.setText("T_critical");

        TCriticalField.setText("21.0");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(OutputText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(10, 10, 10))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(TitleLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(289, 289, 289))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(WindowsLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(windowsTextField))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(DropDownCategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(SelectionLabel)
                                    .addComponent(DropDownSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(CategoryLabel)
                                    .addComponent(SelectionAreaLabel)
                                    .addComponent(ModelOptionsHeaderLabel))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(MTextLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(OmegaTextLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(threadsTextLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(TCriticalLabel, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(TCriticalField)
                                    .addComponent(ThreadNumber)
                                    .addComponent(MTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                    .addComponent(OmegaTextField))))
                        .addGap(73, 73, 73))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(OutputLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE)
                                .addComponent(updateDataButton)
                                .addGap(51, 51, 51)
                                .addComponent(runAllTypes)
                                .addGap(53, 53, 53)
                                .addComponent(runAllNames)
                                .addGap(36, 36, 36))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(customDates)
                                            .addComponent(GraphCheckBox))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(customBegDate)
                                            .addComponent(customEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(GraphOptionsHeaderLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(RunProgram, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(StopRunningButton, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ExitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(TitleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(SelectionAreaLabel)
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CategoryLabel)
                    .addComponent(threadsTextLabel)
                    .addComponent(ThreadNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(DropDownCategory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TCriticalLabel)
                            .addComponent(TCriticalField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(20, 20, 20)
                        .addComponent(SelectionLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(DropDownSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(OmegaTextLabel)
                            .addComponent(OmegaTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MTextLabel)
                            .addComponent(MTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addComponent(ModelOptionsHeaderLabel)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(windowsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(WindowsLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RunProgram, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(GraphOptionsHeaderLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(GraphCheckBox)
                                    .addComponent(customBegDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(customDates))
                            .addComponent(customEndDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(StopRunningButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ExitButton)
                    .addComponent(runAllNames)
                    .addComponent(runAllTypes)
                    .addComponent(OutputLabel)
                    .addComponent(updateDataButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(OutputText, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * RunProgramActionPerformed starts when the run button is pressed. 
     * Runs bubble index for a single name.
     */
    private void RunProgramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RunProgramActionPerformed
        new Thread() {
            @Override
            public void run() {
                initializeVariables();
                runnableGUI();
                
                try {
                    BubbleIndex.RunBubbleIndex();
                    
                    //Check to see if a plot will be generated
                    if (theBubbleIndexPlot.GRAPH_ON) {
                        BubbleIndex.displayOutput("Plotting first four time windows...", false);                          
                        
                        try {
                            theBubbleIndexPlot.checkFiles();
                            
                            try {
                                theBubbleIndexPlot.theBubbleIndexPlot();
                                DerivativePlot.DerivativePlot();
                            } catch (Throwable th) {
                                System.out.println("Throwable Exception. Code 001.");
                                BubbleIndex.displayOutput("Error. Unable to Plot.", false);                          
                            }
                        
                        } catch (IOException ex) {
                            System.out.println("IOException Exception. Code 002.");
                            BubbleIndex.displayOutput("Error. Files missing.", false);                          
                        }                        
                    }
                    resetGUI();
                    
                } catch (IOException | ExecutionException | InterruptedException ex) {
                    System.out.println("Exception. Code 003.");
                    this.interrupt();
                    resetGUI();
                }
            }
        }.start();
    }//GEN-LAST:event_RunProgramActionPerformed
    
    /**
     * initializeVariables get values from GUI
     * @param updateall true if RunAll Button is pressed 
     */
    private void initializeVariables() {   

        theBubbleIndexPlot.GRAPH_ON = GraphCheckBox.isSelected();
        theBubbleIndexPlot.isCustomRange = customDates.isSelected();
        BubbleIndex.CategoryName = (String)DropDownCategory.getSelectedItem();
        BubbleIndex.SelectionName = (String)DropDownSelection.getSelectedItem();

        if (customDates.isSelected()){
            theBubbleIndexPlot.begDate = (Date)customBegDate.getValue();
            theBubbleIndexPlot.endDate = (Date)customEndDate.getValue();
        }
    }

    /**
     * runnableGUI disable buttons during program operation
     */
    private void runnableGUI() {
        RunProgram.setEnabled(false);  
        runAllNames.setEnabled(false);
        runAllTypes.setEnabled(false);
        StopRunningButton.setEnabled(true);
        updateDataButton.setEnabled(false);
    }
    
    /**
     * resetGUI enable buttons after program done
     */
    private void resetGUI() {       
        RunProgram.setEnabled(true);
        runAllNames.setEnabled(true);
        runAllTypes.setEnabled(true);
        StopRunningButton.setEnabled(false);
        customEndDate.setValue(new Date());
        updateDataButton.setEnabled(true);
    }
    
    private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed
        System.exit(0);
    }//GEN-LAST:event_ExitButtonActionPerformed

    private void DropDownCategoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DropDownCategoryActionPerformed
        JComboBox cb = (JComboBox)evt.getSource();
        updateDropDownSelection((String)cb.getSelectedItem()); 
    }//GEN-LAST:event_DropDownCategoryActionPerformed

    private void StopRunningButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopRunningButtonActionPerformed
        BuildIndex.Stop = true;
    }//GEN-LAST:event_StopRunningButtonActionPerformed
    
    private void runAllNamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runAllNamesActionPerformed

        new Thread() {
            @Override
            public void run() {
                runnableGUI();

                BubbleIndex.CategoryName = (String)DropDownCategory.getSelectedItem();
                ArrayList<String> updateNames = Indices.categoriesAndComponents.get(BubbleIndex.CategoryName).getComponents();
                
                for (String updateName : updateNames) {
                    BubbleIndex.SelectionName = updateName;
                    MyThread a = new MyThread();
                    a.start();
                    
                    synchronized (a) {
                        try {
                            a.wait();
                        } catch(InterruptedException e) {
                            System.out.println("Exception. Code 004.");
                            BuildIndex.Stop = true;
                        }
                    }
                }
                resetGUI();
            }
        }.start();      
    }//GEN-LAST:event_runAllNamesActionPerformed

    private void updateDataButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateDataButtonActionPerformed
        new Thread() {
            @Override
            public void run() {
                runnableGUI();
                updateData.updateData();
                resetGUI();
            }
        }.start();
    }//GEN-LAST:event_updateDataButtonActionPerformed

    private void runAllTypesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runAllTypesActionPerformed
        new Thread() {
    	    @Override
            public void run() {
                runnableGUI();
                
                for (Entry<String, InputCategory> myEntry : Indices.categoriesAndComponents.entrySet()) {
                    
                    BubbleIndex.CategoryName = myEntry.getKey();
                    updateDropDownSelection(BubbleIndex.CategoryName);
                    ArrayList<String> updateNames = myEntry.getValue().getComponents();
                    
                    for (String updateName : updateNames) {
                        BubbleIndex.SelectionName = updateName;
                        MyThread a = new MyThread();
                        a.start();
                        
                        synchronized (a) {
                            try {
                                a.wait();
                            } catch(InterruptedException e) {
                                System.out.println("Interrupted Exception. Code 005.");
                                BuildIndex.Stop = true;
                            }
                        }
                    }
                }
                resetGUI();
            };
        }.start();
    }//GEN-LAST:event_runAllTypesActionPerformed

    protected void updateDropDownSelection(String name) {
        for (String category : Indices.categoriesAndComponents.keySet()) {
            if (name.equals(category)) {
                InputCategory inputCategory = Indices.categoriesAndComponents.get(category);
                DropDownSelection.setModel(new javax.swing.DefaultComboBoxModel(inputCategory.getComponentsAsArray()));
            }
        }
    }

    public static void main(String args[]) {
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        /* Create and display the form */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        }
        //</editor-fold>
        Indices.initialize();
        
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new GUI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel CategoryLabel;
    private static javax.swing.JComboBox DropDownCategory;
    private static javax.swing.JComboBox DropDownSelection;
    private javax.swing.JButton ExitButton;
    private javax.swing.JCheckBox GraphCheckBox;
    private javax.swing.JLabel GraphOptionsHeaderLabel;
    public static javax.swing.JTextField MTextField;
    private javax.swing.JLabel MTextLabel;
    private javax.swing.JLabel ModelOptionsHeaderLabel;
    public static javax.swing.JTextField OmegaTextField;
    private javax.swing.JLabel OmegaTextLabel;
    private javax.swing.JLabel OutputLabel;
    public static java.awt.TextArea OutputText;
    private javax.swing.JButton RunProgram;
    private javax.swing.JLabel SelectionAreaLabel;
    private javax.swing.JLabel SelectionLabel;
    private static javax.swing.JButton StopRunningButton;
    public static javax.swing.JTextField TCriticalField;
    private javax.swing.JLabel TCriticalLabel;
    public static javax.swing.JTextField ThreadNumber;
    private static javax.swing.JLabel TitleLabel;
    private javax.swing.JLabel WindowsLabel;
    private javax.swing.JFormattedTextField customBegDate;
    private javax.swing.JCheckBox customDates;
    private javax.swing.JFormattedTextField customEndDate;
    private javax.swing.JButton runAllNames;
    private javax.swing.JButton runAllTypes;
    private javax.swing.JLabel threadsTextLabel;
    private javax.swing.JButton updateDataButton;
    public static javax.swing.JTextField windowsTextField;
    // End of variables declaration//GEN-END:variables
}
